package org.springblade.modules.admin.vo.tlw;

import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.modules.admin.enums.MaintainPlanContentEnum;
import org.springblade.modules.admin.enums.TaskStatusEnum;
import org.springblade.modules.admin.vo.WorkTrackVO;

import java.util.Date;
import java.util.List;

/**
 * @Date 13:52 2023/6/17
 * @Description {
 *   梯联网保养分页
 * }
 * @Author lsay
 **/
@Data
public class TlwByPlanVO {

	/**
	 * 工单id
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long planId;

	/**
	 * 电梯id
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long elevatorId;

	/**
	 * 工单类型值
	 */
	private Integer typeStatus;

	/**
	 * 工单类型名称
	 */
	private Integer typeStatusName;

	/**
	 * 电梯位置
	 */
	private String elevatorAddress;

	/**
	 * 电梯运行状态 1-正常 2-停梯
	 */
	private Integer isStop;

	/**
	 * 出厂编码
	 */
	private String factoryNumber;

	/**
	 * 项目id
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long buildingId;

	/**
	 * 项目名称
	 */
	private String buildingName;

	/**
	 * 项目地址
	 */
	private String buildingAddress;

	/**
	 * 工单状态名称
	 */
	private Integer status;

	/**
	 * 工单状态名称
	 */
	private String statusDesc;

	/**
	 * 工单计划时间
	 */
	private Date planDate;

	/**
	 * 工单开始时间
	 */
	private Date planBeginTime;

	/**
	 * 工单结束时间
	 */
	private Date planEndTime;

	private String userName;

	private String templateName;

	private String brandName;

	/**
	 * 工单关联人员
	 */
	private List<TlwPlanUserVO> userVOS;

	/**
	 * 工单关联模板
	 */
	private List<TlwPlanTemplateVO> templateVOS;

	@ApiModelProperty("任务追踪记录")
	private WorkTrackVO workTrack;

	public void setStatus(Integer status) {
		this.status = status;
		if(ObjectUtil.isNotEmpty(status)){
			this.statusDesc = TaskStatusEnum.getTaskName(MaintainPlanContentEnum.MAINTAIN_BY.getId(),status);
		}
	}
}
